package com.hujing;

import java.util.Calendar;
import java.util.Date;

public class CalendarDemo {

    public static void main(String[] args) {
        // Calendar表示日历
        // 创建Calendar对象
        Calendar now = Calendar.getInstance();
        System.out.println(now);

        // 获取当前日历的年
        int year = now.get(Calendar.YEAR);
        System.out.println(year);

        // 获取当前的日期对象
        Date date = now.getTime();
        System.out.println(date);

        // 获取毫秒值
        long millis = now.getTimeInMillis();
        System.out.println(millis);

        // 当前小时加1
        now.add(Calendar.HOUR,1);
        System.out.println(now);
    }
}
